﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Composite.Regions;
using Douban.Core.Menus;
using Microsoft.Practices.Composite.Presentation.Commands;
using Douban.Modules.Broadcast.ViewModels;
using Douban.Modules.Broadcast.Views;

namespace Douban.Modules.Broadcast
{
    public class BroadcastModule : IModule
    {
        private IUnityContainer _container;
        private IRegionManager _regionManger;

        public BroadcastModule(IUnityContainer container, IRegionManager regionManager)
        {
            _container = container;
            _regionManger = regionManager;
        }

        #region IModule Members

        public void Initialize()
        {
            RegisterModuleObjects();
            _container.Resolve<BroadcastController>().Run();
        }

        #endregion 

        private void RegisterModuleObjects()
        {
            _container
                .RegisterType<BroadcastController>(new ContainerControlledLifetimeManager())
                .RegisterType<IBroadcastViewModel, BroadcastViewModel>()
                .RegisterType<IBroadcastView, BroadcastView>();
        }
    }
}
